// 不加类型断言，ts自动认为link为HTMLElement类型，而它可能是HTMLAnchorElement类型
const link = document.getElementById('link') as HTMLAnchorElement
// const link = <HTMLAnchorElement>document.getElementById('link')
console.log(link.href)